/**
 * create by young (young2f@outlook.com) on 2020/8/14
 */
'use strict';
const _utils = require('./utils')
const devices = [
  {
    deviceCode: 'DEV3225659899D3SD',
    deviceName: '冲压机1',
    deviceType: '工业设备',
    driveType: 'simens-s7',
    interface: 'NET',
    status: 'RUN',
    organization: '一厂/四车间/冲压工序'
  },
  {
    deviceCode: 'DEV323298998D23SD',
    deviceName: '冲压机2',
    deviceType: '工业设备',
    driveType: 'simens-s7',
    interface: 'NET',
    status: 'STOP',
    organization: '一厂/四车间/冲压工序'
  },
  {
    deviceCode: 'DEV324498998D23SD',
    deviceName: '冲压机3',
    deviceType: '工业设备',
    driveType: 'simens-s7',
    interface: 'NET',
    status: 'MALFUNCTION',
    organization: '江苏南京一厂/四车间/前制程/冲压工序'
  },
  {
    deviceCode: 'DEV324498998D23SD',
    deviceName: '冲压机3',
    deviceType: '工业设备',
    driveType: 'simens-s7',
    interface: 'NET',
    status: 'MALFUNCTION',
    organization: '一厂/四车间/冲压工序'
  },
  {
    deviceCode: 'DEV323298998D23SD',
    deviceName: '冲压机2',
    deviceType: '工业设备',
    driveType: 'simens-s7',
    interface: 'NET',
    status: 'STOP'
  },
  {
    deviceCode: 'DEV323298998D23SD',
    deviceName: '冲压机2',
    deviceType: '工业设备',
    driveType: 'simens-s7',
    interface: 'NET',
    status: 'STOP',
    organization: '一厂/四车间/冲压工序'
  },
  {
    deviceCode: 'DEV323298998D23SD',
    deviceName: '冲压机2',
    deviceType: '工业设备',
    driveType: 'simens-s7',
    interface: 'NET',
    status: 'STOP',
    organization: '一厂/四车间/冲压工序'
  },
  {
    deviceCode: 'DEV323298998D23SD',
    deviceName: '冲压机2',
    deviceType: '工业设备',
    driveType: 'simens-s7',
    interface: 'NET',
    status: 'STOP',
    organization: '一厂/四车间/冲压工序'
  },
  {
    deviceCode: 'DEV323298998D23SD',
    deviceName: '冲压机2',
    deviceType: '工业设备',
    driveType: 'simens-s7',
    interface: 'NET',
    status: 'STOP',
    organization: '一厂/四车间/冲压工序'
  },
]

const map = new Map();
map.set('modbus', {

}
);

const manufacturerList=['Modbus','Simens']
export default {
  'POST /api/device/list': (req, res) => {
    console.log('mock', req.route.path, req.body);
    res.send({
      status: 'ok',
      result: {interConfig: devices}
    });
  },
  'GET /api/device/code/get': (req, res) => {
    console.log('mock', req.route.path, req.body);
    res.send({
      status: 'ok',
      result: {deviceCode: _utils.getUUID(16)}
    });
  },
  'GET /api/device/manufacturer/list': (req, res) => {
    console.log('mock', req.route.path, req.body);
    res.send({
      status: 'ok',
      result: {manufacturerList}
    });
  },
  'POST /api/device/drive/query/byManufacturer': (req, res) => {
    console.log('mock', req.route.path, req.body);
    res.send({
      status: 'ok',
      result: {manufacturerList}
    });
  }
}
